#include "friends.h"
#include "config.h"
#include"ctime"
friends::friends()
{ m_friend[0].load(friend1_path);
  m_friend[1].load(friend2_path);
m_friend[2].load(friend3_path);
m_friend[3].load(friend4_path);
m_friend[4].load(friend5_path);
  for(int i=0;i<friends_max;i++)
  {x[i]=game_width;
 y[i]=0;
 free[i]=true;
 speed=friends_speed;
  rect[i].setWidth(m_friend[i].width());
    rect[i].setHeight(m_friend[i].height());
   rect[i].moveTo(x[i],y[i]);}
}


void friends::updatePostion()
{
int i=rand()%(4+1);
        if(free[i])
    {return;}
x[i]-=friends_speed;
rect[i].moveTo(x[i],y[i]);
if(x[i]<=rect[i].width())
{free[i]=true;}

    }
